#ifndef _TASK_HPP__
#define _TASK_HPP__

#include <iostream>
#include <functional>
#include "log.hpp"
typedef std::function<int(int,int)> func_t;

class Task
{
public:
    Task()
    {}
    Task(int x,int y,func_t func)
        :x_(x),y_(y),func_(func)
    {}

    void operator()(const std::string name)
    {
        // std::cout << "线程 " << name << " 处理完成, 结果是: " << x_ << "+" << y_ << "=" << func_(x_, y_) << std::endl;
        logMessage(WARNING, "%s处理完成: %d+%d=%d | %s | %d",
            name.c_str(), x_, y_, func_(x_, y_), __FILE__, __LINE__);
    }
private:
    int x_;
    int y_;
    func_t func_;
};
#endif